﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AllInOne.ModelDb;
using PropertyChanged;

namespace AllInOne.Pages
{
    /// <summary>
    /// ConfirmCarInfoPage.xaml 的交互逻辑
    /// </summary>
    [AddINotifyPropertyChangedInterface]
    public partial class PlateGoodsListPage : Window
    {
        //public ObservableCollection<VerifyPlateList> ModelList { get; set; }

        public List<VerifyPlateList> Records { get; set; }

        private MainWindow parent;

        public VerifyPlateList ThisRecord { get; set; }

        public int SelectIndex { get; set; }

        public PlateGoodsListPage()
        {
            InitializeComponent();
            DataContext = this;
        }

        public PlateGoodsListPage(MainWindow parent)
        {
            InitializeComponent();
            DataContext = this;
            this.parent = parent;
        }


        public void InitPage(List<VerifyPlateList> tempList) {
            Records = tempList;
        }

        private void BtnConfirm_MouseUp(object sender, MouseButtonEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
            //this.parent.ShowSignPad();
        }

        private void BtnBackToIndex_MouseUp(object sender, MouseButtonEventArgs e)
        {
            this.parent.ResetIndex();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ThisRecord = Records[SelectIndex];
                this.DialogResult = true;
                this.Close();
            }
            catch (Exception ex)
            {
                SimpleConsole.WriteInfo("PlateGoodsListPage-当日车辆可拉货物列表选择-出错：" + ex.ToString(), this);
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ////弹出页面
            ////PlateGoodsListPage view1 = new PlateGoodsListPage();
            ////view1.Owner = this.parent;
            ////view1.ShowInTaskbar = false;
            //List<VerifyPlateList> tempList = new List<VerifyPlateList>();
            //VerifyPlateList temp = new VerifyPlateList();
            //temp.Id = 1;
            //temp.GoodsName = "铁粉";
            //temp.Value1 = "2";
            //temp.Value2 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            //temp.Value3 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            //tempList.Add(temp);
            //Records = tempList;

            //ObservableCollection<VerifyPlateList> temp1List = new ObservableCollection<VerifyPlateList>();
            //temp1List.Add(temp);
            //ModelList = temp1List;

            //view1.InitPage(tempList);
            //view1.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            //view1.Show();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            List<VerifyPlateList> tempList = new List<VerifyPlateList>();
            VerifyPlateList temp = new VerifyPlateList();
            temp.Id = 1;
            temp.GoodsName = "蒙D62795";
            temp.Value1 = "2";
            temp.Value2 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            temp.Value3 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            tempList.Add(temp);

            VerifyPlateList temp2 = new VerifyPlateList();
            temp2.Id = 2;
            temp2.GoodsName = "浇注料（铬铝质钢纤维）";
            temp2.Value1 = "2";
            temp2.Value2 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            temp2.Value3 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            tempList.Add(temp2);

            VerifyPlateList temp3 = new VerifyPlateList();
            temp3.Id = 3;
            temp3.GoodsName = "浇注料（铬铝质钢纤维）";
            temp3.Value1 = "2";
            temp3.Value2 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            temp3.Value3 = "赤峰云铜有色金属有限公司（火法厂机修车间）";
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);
            tempList.Add(temp3);

            Records = tempList;
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            this.parent.NoSelectTip();
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            //查询接口

        }


        //this.parent.Confirm("提示语", "提示内容", null, null);
    }
}
